package com.yatang.yiliao.app.fragments;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import android.widget.Button;
import com.yatang.yiliao.app.R;
import io.rong.imkit.RongIM;

/**
 * A simple {@link Fragment} subclass.
 */
public class MessageFragment extends Fragment implements View.OnClickListener {


    public MessageFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View ret = inflater.inflate(R.layout.fragment_message, container, false);
        Button goFriend = (Button)ret.findViewById(R.id.gotoFriendsView);
        Button goView = (Button)ret.findViewById(R.id.gotoView);
        Button goChat = (Button)ret.findViewById(R.id.gotoChatRoom);
        goChat.setOnClickListener(this);
        goFriend.setOnClickListener(this);
        goView.setOnClickListener(this);
        return ret;
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.gotoView:
                RongIM.getInstance().startPrivateChat(getActivity(),
                        "12", "测试帐号");
                break;
            case R.id.gotoFriendsView:
                // 启动会话列表
                RongIM.getInstance().startConversationList(getActivity());
                break;
            case R.id.gotoChatRoom:
                RongIM.getInstance().startChatroom(getActivity(), "20150412", "测试聊天室");
                break;
            default:
                break;
        }
    }
}
